package com.example.userservice.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: 故我
 * Date: 2024-02-13
 * Time: 18:02
 */
@RequestMapping("/v2/user")
@RestController
public class userControllerV2 {
    @Autowired
    private ServletWebServerApplicationContext context;

    @RequestMapping("/getname")
    public String getName() {
        return "Port: " + context.getWebServer().getPort() + " | V2Service: " + new Random().nextInt(10);
    }
}
